package com.artPreter.controller;


import com.artPreter.pojo.BottomLink;
import com.artPreter.pojo.Result;
import com.artPreter.service.IBottomLinkService;
import com.baomidou.mybatisplus.core.metadata.IPage;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.util.List;

/**
 * <p>
 * 艺术分类表 前端控制器
 * </p>
 *
 * @author jarvis
 * @since 2025-01-02
 */
@RestController
@RequestMapping("/bottomLink")
public class BottomLinkController {

    @Autowired
    private IBottomLinkService bottomLinkService;

    /**
     * 底部链接分页
     * @param currentPage
     * @param size
     * @param
     * @return
     */
    @PostMapping("/getPage")
    public Result getPage(@RequestParam(value = "currentPage",defaultValue = "1") Integer currentPage, @RequestParam(value = "size",defaultValue = "10") Integer size, @RequestBody BottomLink bottomLink) {
        IPage<BottomLink> bottomLinkIPage = bottomLinkService.getPage(currentPage, size, bottomLink);
        return Result.success(bottomLinkIPage);
    }

    /**
     *  添加底部链接
     * @param bottomLink
     * @return
     */
    @PostMapping("/add")
    public Result add(@RequestBody BottomLink bottomLink) {
        bottomLinkService.add(bottomLink);
        return Result.success();
    }

    /**
     *  修改底部链接
     * @param
     * @return
     */
    @PostMapping("/edit")
    public Result edit(@RequestBody BottomLink bottomLink) {
        bottomLinkService.edit(bottomLink);
        return Result.success();
    }

    /**
     * 删除底部链接
     * @param
     * @return
     */
    @PostMapping("/delete")
    public Result delete(@RequestBody BottomLink bottomLink){
        bottomLinkService.delete(bottomLink);
        return Result.success();
    }

    /**
     * 获取底部链接列表
     * @param
     * @return
     */
    @PostMapping("/getList")
    public Result getList(@RequestBody BottomLink bottomLink){
        List<BottomLink> result = bottomLinkService.getList(bottomLink);
        return Result.success(result);
    }

}
